package com.woniuxy.springcloud.provider.student.service.impl;

import com.woniuxy.springcloud.common.entity.PageDto;
import com.woniuxy.springcloud.common.entity.Student;
import com.woniuxy.springcloud.provider.student.mapper.StudentMapper;
import com.woniuxy.springcloud.provider.student.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * description: StudentServiceImpl <br>
 * date: 2022/1/19 6:35 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */

@Service
public class StudentServiceImpl implements StudentService {
    @Resource
    StudentMapper studentMapper;


    @Override
    public void addStudent(Student student) {
        studentMapper.insertStudent(student);
    }

    @Override
    public Student getStudentBySid(int sid) {
        return studentMapper.selectStudentBySid(sid);
    }

    @Override
    public List<Student> getAllStudents() {
        return studentMapper.selectAllStudents();
    }

    @Override
    public Integer updateStudentBySid(Student student) {
        Integer bySid = studentMapper.updateStudent(student);
        return bySid;
    }

    @Override
    public Integer deleteOne(int sid) {
        Integer deleteOne = studentMapper.deleteOne(sid);
        return deleteOne;
    }

    @Override
    public List<Student> findAllAndPageination(PageDto pageDto) {
        return studentMapper.findAllPageination(pageDto);
    }
}
